package com.persicadev.khayyam;

import com.persicadev.khayyam.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MainMenuActivity extends Activity {

	ImageButton random;
	ImageButton browse;
	ImageButton search;	
	ImageButton bookmarks;	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mainmenu);

		random=(ImageButton)findViewById(R.id.random);
		browse=(ImageButton)findViewById(R.id.browse);
		search=(ImageButton)findViewById(R.id.search);
		bookmarks=(ImageButton)findViewById(R.id.bookmarks);
		
		OnClickListener listener = new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				switch (v.getId()) {
				case R.id.random:
					startActivity(new Intent(getApplicationContext(), RandomActivity.class));
					overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
					break;
				case R.id.browse:
					startActivity(new Intent(getApplicationContext(), BrowseActivity.class));
					overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
					break;
				case R.id.search:
					startActivity(new Intent(getApplicationContext(), SearchActivity.class));
					overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
					break;
				case R.id.bookmarks:
					startActivity(new Intent(getApplicationContext(), SearchActivity.class).putExtra(SearchActivity.KEY_BOOKMARKS, true));
					overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
					break;
				}
			}
		};
		
		random.setOnClickListener(listener);
		browse.setOnClickListener(listener);
		search.setOnClickListener(listener);
		bookmarks.setOnClickListener(listener);
	}


}
